import 'package:flutter/material.dart';
import 'package:flutter_common/config/config.dart';

class FunAppBar extends StatefulWidget implements PreferredSizeWidget {
  String title;
  List<Widget> actions;
  PreferredSizeWidget bottom;

  FunAppBar({this.title, this.actions, this.bottom});

  @override
  FunAppBarState createState() => FunAppBarState();

  @override
  // TODO: implement preferredSize
  Size get preferredSize => Size.fromHeight(bottom == null ? 45 : 90);
}

class FunAppBarState extends State<FunAppBar> {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return AppBar(
      title: Text(
        widget.title,
        style: TextStyle(color: Config.textWhite, fontSize: 16),
      ),
      centerTitle: true,
      backgroundColor: Config.titleBarColor,
      actions: widget.actions,
      bottom: widget.bottom,
    );
  }
}
